using GameStateManagement.Model.Entities;
using GameStateManagement.Model.Physics.Interfaces;

namespace GameStateManagement.Model.Physics
{
    public class CollisionResolver
    {
        private readonly ICollidable[] _collidables;

        public CollisionResolver(ICollidable entity1, ICollidable entity2)
        {
            _collidables = new ICollidable[2];
            _collidables[0] = entity1;
            _collidables[1] = entity2;
        }

        public void ResolveCollision()
        {
            if (_collidables[0] is StaticEntity && _collidables[1] is StaticEntity)
                return;
            /*
Vector2 colNormal = staticEntity.Facing;
Vector2 relativeVelocity = movingEntity.Direction * movingEntity.Speed;

float separatingVelocity = Vector2.Dot(relativeVelocity, colNormal);

if (separatingVelocity > 0)
{
    float restitutionCoefficient = separatingVelocity / movingEntity.Speed;
    float newSepVelocity = -separatingVelocity * restitutionCoefficient;
    float deltaVelocity = newSepVelocity - separatingVelocity;

    float inverseMass = 1 / movingEntity.Mass;

    if (inverseMass <= 0) return;

    float impulse = deltaVelocity / inverseMass;

    Vector2 impulsePerIMass = colNormal * impulse;

    movingEntity.Direction = Vector2.Normalize(impulsePerIMass);
    movingEntity.Speed += (impulsePerIMass * (inverseMass)).Length();

}
*/
        }

        private float GetRestitutionCoefficient()
        {
            return 0;
        }

        private float CalculateRestitutionCoefficientCollisionWithStaticEntity()
        {
            return 0;
        }

        private float CalculateRestitutionCoefficientCollisionWithMovingEntity()
        {
            return 0;
        }
    }
}
